Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 8 - Tag Objects / Using Tag Objects


Directly Manipulating Tag Object Contents

Unlike with most properties of most objects, QuickDraw GX allows you to directly manipulate a tag object's contents in QuickDraw GX memory. This capability is provided as a convenience, so that you do not have to make a copy of the data; you can achieve the same results by working with a copy of the information in application memory and then replacing it in the object, using the GXGetTag and GXSetTag functions. See "Getting and Setting a Tag Object's Tag Type and Contents" on page 8-10 for information on working with GXGetTag and GXSetTag.

As with GXGetTag and GXSetTag, the direct-manipulation functions do not provide you with information about the format or organization of the contents of a tag object; they simply give you a pointer to the contents. How you manipulate that information depends on the type of tag you are accessing.

Working with data in QuickDraw GX memory requires that you lock the data before accessing it so that it cannot be relocated or unloaded from memory until you are finished. You first call the GXLockTag function to make sure the tag object doesn't move until you are finished with it. You then call the GXGetTagStructure function, which returns a pointer to and the size of the shape's contents. You can then modify the data as needed. Once finished, you call GXUnlockTag to free the tag object for relocation as needed by QuickDraw GX.

IMPORTANT
Memory-handling complications can occur with locked objects. Locking an object fragments the QuickDraw GX heap, which can result in lower performance. Furthermore, if a fragmented-memory condition occurs during a call, QuickDraw GX may unlock all objects and restart the call. Therefore, be careful about performing memory-intensive operations while there are locked objects in QuickDraw GX memory; they may become unlocked without warning.
The GXLockTag function is described on page 8-21. The GXGetTagStructure function is described on page 8-23. The GXUnlockTag function is described on page 8-22.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996